
/**
 * User model
 *
 * @author glory.xu
 */

import { Application } from 'egg';

export default function(app: Application) {
  const { STRING, INTEGER } = app.Sequelize;
  const User = app.model.define('users', {
    id: {
      type: INTEGER,
      primaryKey: true,
      autoIncrement: true,
    },
    name: STRING,
    password: STRING,
    weibo: STRING,
    email: STRING,
    introduce: STRING,
    avatar: STRING,
    role: STRING,
  }, {
    freezeTableName: true,
    tableName: 'user',
  });

  return class extends User {};
}
